import baseApi from '@/config/server/api/base.js'
import buildingApi from '@/config/server/api/building.js'
import customerApi from '@/config/server/api/customer.js'
import userApi from '@/config/server/api/user.js'


function cityBaseList(info) {
  return baseApi.city.cityBaseList.fetch(info)
}

function aggChannelQueryGroupBuilding(info) {
  return baseApi.caseChannel
    .caseChannelList.fetch(info).then(res => { return res })
}


function customerinfoHeadList(info) {
  return customerApi.customer.customerinfoHeadList.fetch(
    info).then(res => { return res })
}

function getCustomerInfoAll(info) {
  return customerApi.customer.getCustomerInfoAll.fetch(info)
    .then(res => { return res })
}

function importCustomerList(info) {
  return customerApi.customer.importCustomerList.fetch(info)
    .then(res => { return res })
}

function adviserList(info) {
  return userApi.customer.adviserList.fetch(info).then(
    res => {
      res.forEach(item => {
        item.userName = `${item.userName}（${item.validate==1?"在职":"离职"}）`
      })
      return res
    })
}

function customerAssignment(info) {
  return customerApi.customer.customerAssignment.fetch(info)
    .then(res => { return res })
}

function customerHeadList(info) {
  return customerApi.customer.customerHeadList.fetch(info)
    .then(res => { return res })
}

function customerHeadClueList(info) {
  return customerApi.clue.clueHeadList.fetch(info)
    .then(res => { return res })
}

function customerHeadUpdate(info) {
  return customerApi.customer.customerHeadUpdate.fetch(info)
    .then(res => { return res })
}

function followUp(info) {
  return customerApi.customer.followUp.fetch(info).then(
    res => { return res })
}

function updateFollowUp(info) {
  return customerApi.customer.updateFollowUp.fetch(info).then(
    res => { return res })
}

function insertFollowUp(info) {
  return customerApi.customer.insertFollowUp.fetch(info).then(
    res => { return res })
}

function getCustomerListNew(info) {
  return customerApi.customer.getCustomerListNew.fetch(info)
    .then(res => { return res })
}

function webGetCustomerDynamicList(info) {
  return customerApi.customer
    .webGetCustomerDynamicList.fetch(info).then(res => { return res })
}

function counselorList(info) {
  return userApi.counselorList.fetch(info).then(
    res => { return res })
}

function selectAggregationCriteria(info) {
  return buildingApi.generalConfiguration
    .selectAggregationCriteria.fetch(info).then(res => { return res })
}

function changeAttention(info) {
  return customerApi.customer.changeAttention.fetch(info).then(
    res => { return res })
}


// 台账
function getstandingBookGetGroup(info) {
  return customerApi.standBookList.getstandingBookGetGroup.fetch(info)
}

//客户导入明细
function exportParameterExcel(params) {
  return customerApi.customer.exportParameterExcel.fetch(params)
}

function importParameterExcel(commissionId) {
  let upload = customerApi.importParameterExcel
  upload.setData(commissionId)
  return upload
}

// 分配记录
function getDistributeLogPage(info) {
  return customerApi.customer.getDistributeLogPage.fetch(info)
}


function getDistributeLogPageDetails(info) {
  return customerApi.customer.getDistributeLogPageDetails.fetch(info)
}

function checkDistributeList(info) {
  return customerApi.customer.checkDistributeList.fetch(info)
}

function updateCustomerChannel(info) {
  return customerApi.customer.updateCustomerChannel.fetch(info)
}

function customerCount(info) {
  return customerApi.count.customerCount.fetch(info)
}

function publicClueCount(info) {
  return customerApi.count.publicClueCount.fetch(info)
}

function getDistributeLogPageExport(info) {
  return customerApi.customer.getDistributeLogPageExport.fetch(info)
}


export default {
  publicClueCount,
  customerCount,
  cityBaseList,
  aggChannelQueryGroupBuilding,
  customerinfoHeadList,
  getCustomerInfoAll,
  importCustomerList,
  adviserList,
  customerAssignment,
  customerHeadList,
  customerHeadClueList,
  customerHeadUpdate,
  followUp,
  updateFollowUp,
  insertFollowUp,
  getCustomerListNew,
  webGetCustomerDynamicList,
  counselorList,
  selectAggregationCriteria,
  changeAttention,
  getstandingBookGetGroup,
  exportParameterExcel,
  importParameterExcel,
  // 分配记录
  getDistributeLogPage,
  getDistributeLogPageExport,
  getDistributeLogPageDetails,
  checkDistributeList,
  updateCustomerChannel
}